<#if (POINT_CO!) == 'top'>
UPDATE FD_DICTIONARY_TY T
SET PARENT_ID =
  (SELECT SDT.PARENT_ID
  FROM FD_DICTIONARY_TY SDT
  WHERE SDT.ID = :PARENT_ID
  ) ,ORDER_NUM = NVL (
  (SELECT ABS(SDT.ORDER_NUM - 1)
  FROM FD_DICTIONARY_TY SDT
  WHERE SDT.ID = :PARENT_ID
  ) , 0 )
WHERE ID = :ID
<#elseif (POINT_CO!) == 'bottom'>
UPDATE FD_DICTIONARY_TY T
SET PARENT_ID =
  (SELECT SDT.PARENT_ID
  FROM FD_DICTIONARY_TY SDT
  WHERE SDT.ID = :PARENT_ID
  ) ,ORDER_NUM = NVL (
  (SELECT ABS(SDT.ORDER_NUM + 1)
  FROM FD_DICTIONARY_TY SDT
  WHERE SDT.ID = :PARENT_ID
  ) , 0 )
WHERE ID = :ID
<#else>
UPDATE FD_DICTIONARY_TY T
SET PARENT_ID = :PARENT_ID ,ORDER_NUM = (NVL (
  (SELECT MAX(SDT.ORDER_NUM)
  FROM FD_DICTIONARY_TY SDT
  WHERE SDT.PARENT_ID = :PARENT_ID
  ) , 0 ) + 1)
WHERE ID = :ID
</#if>